/**Variable**/
@import './helpers/mixin.scss';

%ButtonHover {
  color: lighten($vxe-primary-color, 6%);
  border-color: lighten($vxe-primary-color, 10%);
}

%ButtonPrimaryHover {
  color: #fff;
  background-color: lighten($vxe-primary-color, 4%);
  border-color: lighten($vxe-primary-color, 4%);
}

.vxe-button {
  position: relative;
  text-align: center;
  background-color: #fff;
  outline: 0;
  font-size: $vxe-font-size;
  white-space: nowrap;
  user-select: none;
  @include animatTransition(border, .2s);
  &.is--disabled {
    color: $vxe-disabled-color;
    &:not(.is--loading) {
      cursor: no-drop;
    }
  }
  &:not(.is--disabled) {
    color: $vxe-font-color;
    cursor: pointer;
  }
  &.is--loading {
    &:before {
      content: "";
      position: absolute;
      left: -1px;
      top: -1px;
      right: -1px;
      bottom: -1px;
      border-radius: inherit;
      background-color: hsla(0,0%,100%,.35);
      pointer-events: none;
    }
  }
  &.type--text {
    text-decoration: none;
    border: 0;
    background-color: transparent;
    &:not(.is--disabled) {
      &:hover {
        color: lighten($vxe-primary-color, 10%);
      }
    }
  }
  &.type--button {
    padding: 0 1em;
    height: $vxe-button-height-default;
    line-height: $vxe-button-height-default - 2px;
    border: 1px solid $vxe-input-border-color;
    border-radius: 0.2em;
    &.theme--primary {
      color: #fff;
      .vxe-button--icon {
        border-color: #fff;
      }
      &:not(.is--disabled) {
        border-color: $vxe-primary-color;
        background-color: $vxe-primary-color;
        &:hover {
          @extend %ButtonPrimaryHover;
        }
        &:active {
          color: #fff;
          background-color: darken($vxe-primary-color, 2%);
          border-color: darken($vxe-primary-color, 2%);
        }
      }
      &.is--disabled {
        border-color: #a0cfff;
        background-color: #a0cfff;
      }
      &.is--loading {
        border-color: $vxe-primary-color;
        background-color: $vxe-primary-color;
      }
    }
    &:not(.theme--primary) {
      &:not(.is--disabled) {
        &:hover {
          @extend %ButtonHover;
        }
        &:active {
          color: darken($vxe-primary-color, 2%);
          border-color: darken($vxe-primary-color, 2%);
        }
      }
    }
  }
  &.size--medium {
    font-size: $vxe-font-size-medium;
    &.type--button {
      height: $vxe-button-height-medium;
      line-height: $vxe-button-height-medium - 2px;
    }
  }
  &.size--small {
    font-size: $vxe-font-size-small;
    &.type--button {
      height: $vxe-button-height-small;
      line-height: $vxe-button-height-small - 2px;
    }
  }
  &.size--mini {
    font-size: $vxe-font-size-mini;
    &.type--button {
      height: $vxe-button-height-mini;
      line-height: $vxe-button-height-mini - 2px;
    }
  }
}
.vxe-input,
.vxe-button {
  &+.vxe-button,
  &+.vxe-button--dropdown {
    margin-left: 0.8em;
  }
}
.vxe-button--loading-icon,
.vxe-button--icon {
  margin-right: 5px;
}
.vxe-button--wrapper,
.vxe-button--dropdown {
  display: inline-block;
}
.vxe-button--dropdown {
  position: relative;
  &+.vxe-button,
  &+.vxe-button--dropdown {
    margin-left: 0.8em;
  }
  &.is--active {
    & > .vxe-button {
      &.theme--primary {
        @extend %ButtonPrimaryHover;
      }
      &:not(.is--disabled) {
        &:not(.theme--primary) {
          @extend %ButtonHover;
        }
      }
    }
    .vxe-button--dropdown-arrow {
      transform: rotate(180deg);
    }
  }
}

.vxe-button--dropdown-arrow {
  font-size: 12px;
  margin: -0.18em 0 0 0.3em;
  @include animatTransition(transform, .2s);
}

.vxe-button--dropdown-panel {
  display: none;
  position: absolute;
  left: 50%;
  padding: 0.2em 0;
  min-width: 100%;
  &.animat--leave {
    display: block;
    opacity: 0;
    transform: translateX(-50%) scaleY(0.5);
    transition: all 0.2s;
    transform-origin: 0% 0%;
  }
  &.animat--enter {
    opacity: 1;
    transform: translateX(-50%) scaleY(1);
  }
}
.vxe-button--dropdown-wrapper {
  padding: 5px;
  background-color: #fff;
  border-radius: 4px;
  border: 1px solid $vxe-input-border-color;
  box-shadow: 0 1px 6px rgba(0,0,0,.2);
  & > .vxe-button {
    margin: 0;
    display: block;
    width: 100%;
    border: 0;
    &.type--text {
      padding: 2px 8px;
    }
  }
}